<?php

class Company extends AppModel {
  public $name = 'Company';
  public $belongsTo = array('Service'=>array(
      'className'=> 'Service',
      'foreignKey'=>'service_id',
      'type' =>'inner'
 ));
  public $hasMany = array('Ad'=> array('className'=>'Ad', 'foreign_key'=>'company_id', 'dependent'=>true),
                          'Coupon'=> array('className'=>'Coupon', 'foreign_key'=>'company_id', 'dependent'=>true));


  public $validate = array(
      'Company.name' => array(
          'name' => 'notEmpty',
          'message'=>'Name is required'
      ),
      'Company.image_path'=>array(
              'rule'=>array('validImageFormat'),
              'message'=>'Specify a valid image (gif, jpg, png)',
              'allowEmpty'=>true,
                'required'=>false
      ),
      'Company.email'=>array(
          'required' => array(
            'rule' => array('email',true),
            'allowEmpty'=> true,
            'required'=>false,
            'message'=>'Specify a valid email address'
          )
      )/*,
       'phone' => array(
          'rule' => array('phone',null,'us'),
          'allowEmpty'=> true,
          'required'=>false,
          'message'=>'Specify a valid email phone number'
      ),
       'phone2' => array(
          'rule' => array('phone',null,'us'),
          'allowEmpty'=> true,
          'required'=>false,
          'message'=>'Specify a valid email phone number'
      )*/
  );
   //http://book.cakephp.org/1.3/view/1042/belongsTo


  
}

?>
